package com.ass.database.builder;

import com.ass.database.entity.DbDatabase;
import com.ass.database.entity.DbSource;

import java.sql.Connection;
import java.sql.SQLException;
import java.sql.Statement;

public abstract class DbBuilder {



    /**
     * @describe：获得驱动
     * @author：李勇
     * @date：2024/10/30
     * @param
     * @return：java.lang.String
     */
    public abstract String getJdbcDriver();


    /**
     * datasource连接
     * @param dataSource
     * @return
     */
    protected abstract Connection getConn(DbSource dataSource);


    /**
     * 关闭
     *
     * @author: liyong
     * @date: 2024/2/21 11:23
     * @param conn:
     * @param stat:
     * @return: void
     */
    protected void close(Connection conn, Statement stat) {
        try {
            if (conn != null) {
                conn.close();
            }
            if (stat != null) {
                stat.close();
            }
        } catch (SQLException e) {
            throw new RuntimeException(e);
        }
    }


    //单条增

    //批量增

    //删


    //改

    //查

    //自定义SQL语句

    //获取数据库的本身信息
}
